package com.woniu.lifeservice.controller;

import com.woniu.common.entity.Result;
import com.woniu.lifeservice.service.ICategoryService;
import com.woniu.lifeservice.vo.CategoryVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 分类表 前端控制器
 * </p>
 *
 * @author hushunlai
 * @since 2023-05-22
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private ICategoryService categoryService;

    @ApiOperation("分类查询")
    @GetMapping("/getCategoryById/{parentId}")
    public Result getCategoryById(@PathVariable Integer parentId){
        List<CategoryVO> categoryVOList = categoryService.CategorySearch(parentId);
        return Result.ok(categoryVOList);
    }

}
